package com.example.demoweb.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;

import com.example.demoweb.dao.StudentDao;
import com.example.demoweb.entity.Student;
import com.example.demoweb.service.StudentService;

@Service
@Transactional
public class StudentServiceImpl implements StudentService {

	@Autowired
	private StudentDao studentDao;
	
	@Override
	public Student getStudentById(int id) {
		return studentDao.getStudentById(id);
	}

	@Override
	@Transactional(readOnly=false)
	public void insert(Student student) {
		studentDao.insert(student);
	}

	@Override
	public List<Student> getList() {
		List<Student> list = studentDao.getList();
		return list;
	}

	@Override
	public void insertBatch(List<Student> list) {
		studentDao.insertBatch(list);
	}

}
